package com.algs1_3;

/**
 * 定容字符串栈
 */
public class FixedCapacityStackOfStrings {
    // 栈元素
    private String[] a;
    // size
    private int N;

    // 创建一个容量为cap的空栈
    public FixedCapacityStackOfStrings(int cap){
        a = new String[cap];
    }

    public boolean isEmpty(){
        return N == 0;
    }

    public int size(){
        return N;
    }

    public void push(String item){
        a[N++] = item;
    }

    public String pop(){
        return a[--N];
    }


}
